package com.hudson.plugin.server.hibernateDB.domain.dao;

import com.hudson.plugin.server.hibernateDB.internal.domain.entity.ProjectsEntity;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Richard
 * Date: 5/29/11
 * Time: 10:40 PM
 * To change this template use File | Settings | File Templates.
 */
public interface ProjectsDAOInterface {
    // property constants
    String PROJECT_NAME = "projectName";
    String CHILD_PROJECTS = "childProjects";
    String PARENT_PROJECTS = "parentProjects";
    String TYPE = "type";
    String URL = "url";

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void save(ProjectsEntity transientInstance);

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void delete(ProjectsEntity persistentInstance);

    ProjectsEntity findById(Integer id);

    List findByProperty(String propertyName, Object value);

    List findByProjectName(Object projectName);

    List findByChildProjects(Object childProjects);

    List findByParentProjects(Object parentProjects);

    List findByType(Object type);

    List findByUrl(Object url);

    List findAll();

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    ProjectsEntity merge(ProjectsEntity detachedInstance);

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void attachDirty(ProjectsEntity instance);

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void attachClean(ProjectsEntity instance);

    List<Integer> findProjectsEntityByHudsonIdAndName(Integer hudsonId, String projectName);
}
